<html>
<head>
    <title>日志列表</title>
    <base th:href="@{/}"/>
    <base th:src="@{/}"/>
    <link rel="stylesheet" th:href="@{/static/statics/css/font-awesome.min.css}">
    <link rel="stylesheet" th:href="@{/static/statics/plugins/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/static/statics/plugins/ztree/css/metroStyle/metroStyle.css}">
    <link rel="stylesheet" th:href="@{/static/common/css/cyStyle.css}">
    <link rel="stylesheet" th:href="@{/static/common/css/cyType.css}">
    <script th:src="@{/static/statics/libs/jquery-1.7.2.js}"></script>
    <script th:src="@{/static/statics/plugins/layer/layer.js}"></script>
    <script th:src="@{/static/statics/plugins/layui/layui.js}"></script>
    <script th:src="@{/static/statics/plugins/ztree/jquery.ztree.all.min.js}"></script>
    <script th:src="@{/static/common/js/pageGrid1.js}"></script>
    <script th:src="@{/static/common/js/tplTool.js}"></script>
    <script th:src="@{/static/common/js/editGrid.js}"></script>
    <script th:src="@{/static/common/js/whole/cyLayer.js}"></script>
    <script th:src="@{/static/common/js/whole/common.js}"></script>
    <script th:src="@{/static/common/js/whole/utils.js}"></script>
    <script th:src="@{/static/common/js/whole/monitor.js}"></script>
</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">日志名称:</label>
        <div class="layui-input-inline">
            <input type="text" name="dbname" id="dbname" placeholder="请输入日志名称" class="layui-input">
        </div>
        <label class="layui-form-label">执行SQL:</label>
        <div class="layui-input-inline">
            <input type="text" name="logContent" id="logContent" placeholder="请输入执行SQL" class="layui-input">
        </div>
        <label class="layui-form-label">数据源:</label>
        <div class="layui-input-inline">
            <input type="text" name="logDbSource" id="logDbSource" placeholder="请输入数据源" class="layui-input">
        </div>
        <div class="layui-input-normal">
            <button class="layui-btn search-btn" table-id="pageGrid" lay-submit="" lay-filter="search">
                <i class="fa fa-search"> </i>查询
            </button>
            <button type="reset" class="layui-btn layui-btn-primary"><i class="fa fa-refresh">&nbsp;</i>重置</button>
        </div>
    </div>
</form>
<div class="layui-form nowrap">
   <table class="layui-table" id="pageGrid" cyType="pageGrid"  lay-filter="pageGrid" table-id="pageGrid"
           cyProps="url:'/db/getLogList',checkbox:'false',pageColor:'#2991d9'">
        <thead>
        <tr>
            <th width="5%" param="{name:'id',isPrimary:'true',hide:'false'}">id</th>
            <th width="10%" param="{name:'logName'}">日志名称</th>
            <th width="10%"  param="{name:'logDbSource'}">执行数据源</th>
            <th width="5%" param="{name:'userid'}">操作人</th>
            <th width="5%" param="{name:'logDate'}">操作时间</th>
            <th width="10%" param="{operate:'true',buttons:'Render.viewSql,Render.results'}">操作</th>
        </tr>
        </thead>
    </table>
</div>

<script>
    layui.use(['form','table'], function(){
        var form = layui.form;

    });
    var Render = {
        viewSql:function(rowdata){
            var str = rowdata.logContent;
            str=str.replace(/\'/g,"’");
            str=str.replace(/\"/g,"”");
            str=str.replace(/</g,"《").replace(/>/g,"》");
            str=str.replace(/\r/g,"&nbsp;");
            str=str.replace(/\n/g,"<br />");
            str=str.trim();
            var btn=' <button  onclick="openViewText(\''+"查看执行SQL"+'\',\''+str+'\')" class="layui-btn layui-btn-sm  layui-btn-normal ">SQL</button>';
            return btn;
        },
        results:function(rowdata){
            var str = rowdata.logResult;
            str=str.replace(/\'/g,"’");
            str=str.replace(/\"/g,"”");
            str=str.replace(/</g,"《").replace(/>/g,"》");
            str=str.replace(/\r/g,"&nbsp;");
            str=str.replace(/\n/g,"<br />");
            str=str.trim();
            var btn=' <button  onclick="openViewText(\''+"查看执行结果"+'\',\''+str+'\')" class="layui-btn layui-btn-sm layui-btn-danger ">结果</button>';
            return btn;
        }
    };
    </script>
</body>
</html>